﻿<Window x:Class="WPF.DataBinding.DataContext.DataContextWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        Title="DataContextWindow" Height="300" Width="300">
    <!--<Grid Name="grdDataContext" DataContext="{x:Static Member=s:Environment.OSVersion}">-->
    <Grid Name="grdDataContext" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <!--<TextBlock Grid.Column="0" Grid.Row="0" Text="Platform: "/>
        <TextBlock Grid.Column="0" Grid.Row="1" Text="OSVersion: "/>
        <TextBlock Grid.Column="0" Grid.Row="2" Text="ServicePack: "/>-->
        <TextBlock Grid.Column="0" Grid.Row="0" Text="Name: "/>
        <TextBlock Grid.Column="0" Grid.Row="1" Text="Surname: "/>
        <TextBlock Grid.Column="0" Grid.Row="2" Text="Age: "/>

        <!--<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Platform,Mode=OneTime}"/>
        <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Version,Mode=OneTime}"/>
        <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding ServicePack,Mode=OneTime}"/>-->
        
        <TextBox Name="txtName"  Grid.Column="1" Grid.Row="0" Text="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
        <!--değer değiştirip focusu burada tutarken değeri güncellemek için updatesourcetrigger kullandık-->
        <TextBox Name="txtSurname" Grid.Column="1" Grid.Row="1" Text="{Binding Path=Surname,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
        <TextBox Name="txtAge" Grid.Column="1" Grid.Row="2" Text="{Binding Path=Age,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>

        <StackPanel Grid.Column="1" Grid.Row="3" >
            <Button Name="btnShow" Click="btnShow_Click" Content="_Show"/>
            <Button Name="btnChange" Content="Change Age" Click="btnChange_Click"/>
        </StackPanel>
    </Grid>
</Window>
